const show = ({title,mask,icon,image,duration,position,complete}) => {
  uni.showToast({
    title,
    mask,
    icon:'error',
    image,
    duration,
    position,
    complete
  })
}

const analysis = (e,type) => {
  if(typeof e === 'string')
    return { title:e,icon:type }
  e.icon = type
  return e
}

export default{
  success: e => { show(analysis(e,'success')) },
  warning: e => { show(analysis(e,'error')) },
  warn: e => { show(analysis(e,'error')) },
  info: e => { show(analysis(e,'none')) },
  error: e => { show(analysis(e,'error')) },
  loading: e => { show(analysis(e,'loading')) }
}